package mars.ns.events

import mars.ns.core._
import mars.ns.selectors.NodeSelection
import mars.ns.selectors.RandomSelection

trait ConnectEvent[T <: Node] extends SimulationEvent[T] with NodeSelection[T]{
}
class RandomConnectEvent[T <: Node](n2:T,net2:Network[T]) extends ConnectEvent[T] with RandomSelection[T]{
    var linkWasAdded : Boolean = false
    
    def getNode : T = n2
    def executeAction : List[T] = {
        connect(net2,n2)
        linkWasAdded = true
        return List(n2)
    }    
    def nodeChanged : Boolean = {
        return false
    }
    def linkAdded : Boolean = {
        return linkWasAdded
    }
}